home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1999 April: Mac OS SDK / Dev.CD Apr 99 SDK1.toast / Development Kits / Interfaces&Libraries / Universal / Interfaces / PInterfaces / GXMath.p < prev    next >
Encoding:
Text File  |  1998-08-17  |  4.9 KB  |  143 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        GXMath.p
  3.  
  4.      Contains:    QuickDraw GX math routine interfaces.
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Release:    Universal Interfaces 3.2
  8.  
  9.      Copyright:    © 1994-1998 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. }
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT GXMath;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __GXMATH__}
  27. {$SETC __GXMATH__ := 1}
  28.  
  29. {$I+}
  30. {$SETC GXMathIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33. {$IFC UNDEFINED __CONDITIONALMACROS__}
  34. {$I ConditionalMacros.p}
  35. {$ENDC}
  36. {$IFC UNDEFINED __MACTYPES__}
  37. {$I MacTypes.p}
  38. {$ENDC}
  39. {$IFC UNDEFINED __FIXMATH__}
  40. {$I FixMath.p}
  41. {$ENDC}
  42.  
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48.  
  49.  
  50. TYPE
  51.     gxPointPtr = ^gxPoint;
  52.     gxPoint = RECORD
  53.         x:                        Fixed;
  54.         y:                        Fixed;
  55.     END;
  56.  
  57.     gxColorValue                        = UInt16;
  58.     gxPolarPtr = ^gxPolar;
  59.     gxPolar = RECORD
  60.         radius:                    Fixed;
  61.         angle:                    Fixed;
  62.     END;
  63.  
  64.     gxMappingPtr = ^gxMapping;
  65.     gxMapping = RECORD
  66.         map:                    ARRAY [0..2,0..2] OF Fixed;
  67.     END;
  68.  
  69.  
  70.  
  71. CONST
  72.     gxColorValue1                = $0000FFFF;                    {  gxColorValue 1.0  }
  73.  
  74.     gxPositiveInfinity            = $7FFFFFFF;                    {  for Fixed and Fract  }
  75.     gxNegativeInfinity            = $80000000;                    {  for Fixed and Fract  }
  76.  
  77.  
  78. FUNCTION CopyToMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMappingPtr; C;
  79. FUNCTION InvertMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMappingPtr; C;
  80. FUNCTION MapMapping(VAR target: gxMapping; {CONST}VAR source: gxMapping): gxMappingPtr; C;
  81. FUNCTION MoveMapping(VAR target: gxMapping; hOffset: Fixed; vOffset: Fixed): gxMappingPtr; C;
  82. FUNCTION MoveMappingTo(VAR target: gxMapping; hPosition: Fixed; vPosition: Fixed): gxMappingPtr; C;
  83. FUNCTION NormalizeMapping(VAR target: gxMapping): gxMappingPtr; C;
  84. FUNCTION RotateMapping(VAR target: gxMapping; angle: Fixed; xCenter: Fixed; yCenter: Fixed): gxMappingPtr; C;
  85. FUNCTION ScaleMapping(VAR target: gxMapping; hFactor: Fixed; vFactor: Fixed; xCenter: Fixed; yCenter: Fixed): gxMappingPtr; C;
  86. FUNCTION ResetMapping(VAR target: gxMapping): gxMappingPtr; C;
  87. FUNCTION SkewMapping(VAR target: gxMapping; skewX: Fixed; skewY: Fixed; xCenter: Fixed; yCenter: Fixed): gxMappingPtr; C;
  88. PROCEDURE MapPoints({CONST}VAR source: gxMapping; count: LONGINT; VAR vector: gxPoint); C;
  89. FUNCTION FirstBit(x: UInt32): INTEGER; C;
  90. FUNCTION WideScale({CONST}VAR source: wide): INTEGER; C;
  91. FUNCTION LinearRoot(first: Fixed; last: Fixed; VAR t: Fract): INTEGER; C;
  92. FUNCTION QuadraticRoot(first: Fixed; control: Fixed; last: Fixed; VAR t: Fract): INTEGER; C;
  93. FUNCTION PolarToPoint({CONST}VAR ra: gxPolar; VAR xy: gxPoint): gxPointPtr; C;
  94. FUNCTION PointToPolar({CONST}VAR xy: gxPoint; VAR ra: gxPolar): gxPolarPtr; C;
  95. FUNCTION FractCubeRoot(source: Fract): Fract; C;
  96. FUNCTION FractDivide(dividend: Fract; divisor: Fract): Fract; C;
  97. FUNCTION FractMultiply(multiplicand: Fract; multiplier: Fract): Fract; C;
  98. FUNCTION FractSineCosine(degrees: Fixed; VAR cosine: Fract): Fract; C;
  99. FUNCTION FractSquareRoot(source: Fract): Fract; C;
  100. FUNCTION FixedDivide(dividend: Fixed; divisor: Fixed): Fixed; C;
  101. FUNCTION FixedMultiply(multiplicand: Fixed; multiplier: Fixed): Fixed; C;
  102. { This next call is (source * multiplier / divisor) -- it avoids underflow, overflow by using wides }
  103. FUNCTION MultiplyDivide(source: LONGINT; multiplier: LONGINT; divisor: LONGINT): LONGINT; C;
  104. FUNCTION Magnitude(deltaX: LONGINT; deltaY: LONGINT): UInt32; C;
  105. FUNCTION VectorMultiplyDivide(count: LONGINT; {CONST}VAR vector1: LONGINT; step1: LONGINT; {CONST}VAR vector2: LONGINT; step2: LONGINT; divisor: LONGINT): LONGINT; C;
  106.  
  107.  
  108.  
  109. { wide operations are defined within FixMath.h only for PowerPC }
  110. {$IFC NOT TARGET_CPU_PPC }
  111. FUNCTION WideAdd(VAR target: wide; {CONST}VAR source: wide): widePtr; C;
  112. FUNCTION WideCompare({CONST}VAR target: wide; {CONST}VAR source: wide): INTEGER; C;
  113. FUNCTION WideNegate(VAR target: wide): widePtr; C;
  114. FUNCTION WideShift(VAR target: wide; shift: LONGINT): widePtr; C;
  115. FUNCTION WideSquareRoot({CONST}VAR source: wide): UInt32; C;
  116. FUNCTION WideSubtract(VAR target: wide; {CONST}VAR source: wide): widePtr; C;
  117. FUNCTION WideMultiply(multiplicand: LONGINT; multiplier: LONGINT; VAR target: wide): widePtr; C;
  118. { returns the quotient }
  119. FUNCTION WideDivide({CONST}VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): LONGINT; C;
  120. { quotient replaces dividend }
  121. FUNCTION WideWideDivide(VAR dividend: wide; divisor: LONGINT; VAR remainder: LONGINT): widePtr; C;
  122. {$ENDC}
  123.  
  124.  
  125.  
  126. FUNCTION VectorMultiply(count: LONGINT; {CONST}VAR vector1: LONGINT; step1: LONGINT; {CONST}VAR vector2: LONGINT; step2: LONGINT; VAR dot: wide): widePtr; C;
  127. FUNCTION RandomBits(count: LONGINT; focus: LONGINT): UInt32; C;
  128. PROCEDURE SetRandomSeed({CONST}VAR seed: wide); C;
  129. FUNCTION GetRandomSeed(VAR seed: wide): widePtr; C;
  130.  
  131.  
  132.  
  133. {$ALIGN RESET}
  134. {$POP}
  135.  
  136. {$SETC UsingIncludes := GXMathIncludes}
  137.  
  138. {$ENDC} {__GXMATH__}
  139.  
  140. {$IFC NOT UsingIncludes}
  141.  END.
  142. {$ENDC}
  143.